package route

import (
	"github.com/gin-gonic/gin"
	"server/app/api/handel/common"
	user3 "server/app/api/handel/user"
	"server/app/api/middleware"
)

type UserRoute struct{}

func (UserRoute) InitRoute(r *gin.RouterGroup) {

	r.POST("user/auth/login", user3.Auth.Login)

	user := r.Group("user", middleware.UserMiddleWare())
	{
		user.POST("common/upload_image", common.Upload.UploadImage)
		user.POST("info", user3.User.Info)
		user.POST("mine/info", user3.Mine.Info)
		user.POST("mine/update", user3.Mine.Update)
		user.POST("mine/update_intro", user3.Mine.UpdateIntro)
		user.POST("mine/update_by_field", user3.Mine.UpdateByField)

		user.POST("pool/register", user3.Pool.Register)

		user.POST("message/send_to_user", user3.Message.SendToUser)
		user.POST("message/send_to_group", user3.Message.SendToGroup)

		moment := user.Group("moment")
		{
			moment.POST("post", user3.Moment.Post)
			moment.POST("pull", user3.Moment.Pull)
		}

		group := user.Group("group")
		{
			group.POST("info", user3.Group.Info)
			group.POST("message", user3.Group.Message)
		}
	}
}
